package com.platform.wechat.controller;

import com.platform.wechat.common.JsonBean;
import com.platform.wechat.service.OfficeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author YP
 * @company ~~
 * @create 2021-07-28 15:06
 */
@RestController
@RequestMapping("office")
public class OfficeController {
    /**
     * 注释
     */
    @Autowired
    private OfficeService officeService;

    /**
    * @Description: 根据主科室id查询科室信息
    * @Param: [parentId]
    * @return: com.platform.wechat.common.JsonBean
    * @Author: YP,guopeixin
    * @Date: 2021/7/28
    * @Time: 16:16
    */
    @RequestMapping("getOfficeByParentId")
    public JsonBean getOfficeByParentId(Integer chiefofficesId){

        return officeService.selectByParentId(chiefofficesId);
    }

    /**
     * @Description: 根据医院id查询科室信息
     * @Param: [hospitalId]
     * @return: com.platform.wechat.common.JsonBean
     * @Author: MaYongQiang
     * @Date: 2021/7/28
     * @time: 17:17
     */
    @RequestMapping("getInHospitalById")
    public JsonBean getInHospitalById(Integer hospitalId){
        //System.out.println("医院id:" + hospitalId);
        JsonBean jsonBean = officeService.selectInHospitalById(hospitalId);
        return jsonBean;
    }


    /**
    * @Date: 2021/8/1 23:12
    * @Author: guopeixin
    * @Description:  查一个通过officesId
    */
    @GetMapping("selectOneByOfficesId")
    public JsonBean selectByChiefofficesId(Integer officesId){
        //System.out.println("科室id:" + officesId);
        JsonBean jsonBean = officeService.selectOneByOfficesId(officesId);
        return jsonBean;
    }

}
